package net.stancristian.restnews;

import java.util.Date;

import org.json.JSONException;
import org.json.JSONObject;

public class NewsItemBase {

	public Integer Id;
	public String Title;
	public String Summary;
	public Date  ModificationDate;
	
	public NewsItemBase() {
		Id = 0;
		Title = "No title";
		Summary = "No news item loaded";
	}
	
	public NewsItemBase(JSONObject json) {
		try {
			Title = json.getString("Title");
			Summary = json.getString("Summary");
			Id = json.getInt("Id");
			String modificationDateString = json.getString("ModificationDate");
			ModificationDate = Utils.ParseJSONDateString(modificationDateString);
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}
	
	
}
